package com.moxi.mougblog.base.entity;
import java.io.Serializable;
import java.util.Date;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;


/**
 * Entity基类
 * @author xuzhixiang
 * @date 2018年9月17日09:47:12
 *
 */
@Data
@SuppressWarnings("rawtypes")
public class SuperEntity<T extends Model> extends Model {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4851055162892178225L;

	/**
	 * 唯一UID
	 */
	@TableId(value = "uid", type = IdType.UUID)
	private String uid;

	/**
	 * 状态 0：失效  1：生效
	 */
	private int status;
	
	/**
	 * @TableField 配置需要填充的字段
	 * 创建时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date createTime;

	/**
	 * 更新时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;
	
	public SuperEntity() {
		this.status = 1;
		this.createTime = new Date(); 
		this.updateTime = new Date(); 
	}
}